﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;

using XCode;
using BingZi.HY.Core;
using XCode.DataAccessLayer;
using XCode.Configuration;



namespace BingZi.HY.Core
{
    /// <summary>功能模块</summary>
    [Serializable]
    [DataObject]
    [Description("功能模块")]
    [BindIndex("PK_Sys_Module", true, "ModuleID")]
    [BindTable("sys_Module", Description = "功能模块", ConnName = "System")]
    public partial class sys_Module<TEntity> : Isys_Module
    {
        #region 属性
        private Int32 _ModuleID;
        /// <summary>功能模块ID号</summary>
        [DisplayName("功能模块ID号")]
        [Description("功能模块ID号")]
        [DataObjectField(true, true, false, 10)]
        [BindColumn(1, "ModuleID", "功能模块ID号", null, "int", 10, 0, false)]
        public Int32 ModuleID
        {
            get { return _ModuleID; }
            set { if (OnPropertyChanging("ModuleID", value)) { _ModuleID = value; OnPropertyChanged("ModuleID"); } }
        }

        private Int32 _M_ApplicationID;
        /// <summary>所属应用程序ID</summary>
        [DisplayName("所属应用程序ID")]
        [Description("所属应用程序ID")]
        [DataObjectField(false, false, true, 10)]
        [BindColumn(2, "M_ApplicationID", "所属应用程序ID", null, "int", 10, 0, false)]
        public Int32 M_ApplicationID
        {
            get { return _M_ApplicationID; }
            set { if (OnPropertyChanging("M_ApplicationID", value)) { _M_ApplicationID = value; OnPropertyChanged("M_ApplicationID"); } }
        }

        private Int32 _M_ParentID;
        /// <summary>所属父级模块ID与ModuleID关联,0为顶级</summary>
        [DisplayName("所属父级模块ID与ModuleID关联,0为顶级")]
        [Description("所属父级模块ID与ModuleID关联,0为顶级")]
        [DataObjectField(false, false, false, 10)]
        [BindColumn(3, "M_ParentID", "所属父级模块ID与ModuleID关联,0为顶级", "0", "int", 10, 0, false)]
        public Int32 M_ParentID
        {
            get { return _M_ParentID; }
            set { if (OnPropertyChanging("M_ParentID", value)) { _M_ParentID = value; OnPropertyChanged("M_ParentID"); } }
        }

        private String _M_PageCode;
        /// <summary>模块编码Parent为0,则为S00(xx),否则为S00M00(xx)</summary>
        [DisplayName("模块编码Parent为0,则为S00(xx),否则为S00M00(xx)")]
        [Description("模块编码Parent为0,则为S00(xx),否则为S00M00(xx)")]
        [DataObjectField(false, false, true, 100)]
        [BindColumn(4, "M_PageCode", "模块编码Parent为0,则为S00(xx),否则为S00M00(xx)", null, "varchar(100)", 0, 0, false)]
        public String M_PageCode
        {
            get { return _M_PageCode; }
            set { if (OnPropertyChanging("M_PageCode", value)) { _M_PageCode = value; OnPropertyChanged("M_PageCode"); } }
        }

        private String _M_CName;
        /// <summary>模块/栏目名称当ParentID为0为模块名称</summary>
        [DisplayName("模块/栏目名称当ParentID为0为模块名称")]
        [Description("模块/栏目名称当ParentID为0为模块名称")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn(5, "M_CName", "模块/栏目名称当ParentID为0为模块名称", null, "nvarchar(50)", 0, 0, true)]
        public String M_CName
        {
            get { return _M_CName; }
            set { if (OnPropertyChanging("M_CName", value)) { _M_CName = value; OnPropertyChanged("M_CName"); } }
        }

        private String _M_Directory;
        /// <summary>模块/栏目???录名</summary>
        [DisplayName("模块/栏目???录名")]
        [Description("模块/栏目???录名")]
        [DataObjectField(false, false, true, 255)]
        [BindColumn(6, "M_Directory", "模块/栏目???录名", null, "nvarchar(255)", 0, 0, true)]
        public String M_Directory
        {
            get { return _M_Directory; }
            set { if (OnPropertyChanging("M_Directory", value)) { _M_Directory = value; OnPropertyChanged("M_Directory"); } }
        }

        private String _M_OrderLevel;
        /// <summary>当前所在排序级别支持双层99级菜单</summary>
        [DisplayName("当前所在排序级别支持双层99级菜单")]
        [Description("当前所在排序级别支持双层99级菜单")]
        [DataObjectField(false, false, true, 4)]
        [BindColumn(7, "M_OrderLevel", "当前所在排序级别支持双层99级菜单", null, "varchar(4)", 0, 0, false)]
        public String M_OrderLevel
        {
            get { return _M_OrderLevel; }
            set { if (OnPropertyChanging("M_OrderLevel", value)) { _M_OrderLevel = value; OnPropertyChanged("M_OrderLevel"); } }
        }

        private Int32 _M_IsSystem;
        /// <summary>是否为系统模块1:是0:否如为系统则无法修改</summary>
        [DisplayName("是否为系统模块1:是0:否如为系统则无法修改")]
        [Description("是否为系统模块1:是0:否如为系统则无法修改")]
        [DataObjectField(false, false, true, 3)]
        [BindColumn(8, "M_IsSystem", "是否为系统模块1:是0:否如为系统则无法修改", null, "tinyint", 3, 0, false)]
        public Int32 M_IsSystem
        {
            get { return _M_IsSystem; }
            set { if (OnPropertyChanging("M_IsSystem", value)) { _M_IsSystem = value; OnPropertyChanged("M_IsSystem"); } }
        }

        private Int32 _M_Close;
        /// <summary>是否关闭1:是0:否</summary>
        [DisplayName("是否关闭1:是0:否")]
        [Description("是否关闭1:是0:否")]
        [DataObjectField(false, false, true, 3)]
        [BindColumn(9, "M_Close", "是否关闭1:是0:否", "1", "tinyint", 3, 0, false)]
        public Int32 M_Close
        {
            get { return _M_Close; }
            set { if (OnPropertyChanging("M_Close", value)) { _M_Close = value; OnPropertyChanged("M_Close"); } }
        }

        private String _M_Icon = "~/manager/images/icon/module.gif ";
        /// <summary>模块Icon</summary>
        [DisplayName("模块Icon")]
        [Description("模块Icon")]
        [DataObjectField(false, false, true, 255)]
        [BindColumn(10, "M_Icon", "模块Icon", "~/manager/images/icon/module.gif", "varchar(255)", 0, 0, false)]
        public String M_Icon
        {
            get { return _M_Icon; }
            set { if (OnPropertyChanging("M_Icon", value)) { _M_Icon = value; OnPropertyChanged("M_Icon"); } }
        }

        private String _M_Info;
        /// <summary>模块说明</summary>
        [DisplayName("模块说明")]
        [Description("模块说明")]
        [DataObjectField(false, false, true, 500)]
        [BindColumn(11, "M_Info", "模块说明", "", "nvarchar(500)", 0, 0, true)]
        public String M_Info
        {
            get { return _M_Info; }
            set { if (OnPropertyChanging("M_Info", value)) { _M_Info = value; OnPropertyChanged("M_Info"); } }
        }
        #endregion

        #region 获取/设置 字段值
        /// <summary>
        /// 获取/设置 字段值。
        /// 一个索引，基类使用反射实现。
        /// 派生实体类可重写该索引，以避免反射带来的性能损耗
        /// </summary>
        /// <param name="name">字段名</param>
        /// <returns></returns>
        public override Object this[String name]
        {
            get
            {
                switch (name)
                {
                    case "ModuleID": return _ModuleID;
                    case "M_ApplicationID": return _M_ApplicationID;
                    case "M_ParentID": return _M_ParentID;
                    case "M_PageCode": return _M_PageCode;
                    case "M_CName": return _M_CName;
                    case "M_Directory": return _M_Directory;
                    case "M_OrderLevel": return _M_OrderLevel;
                    case "M_IsSystem": return _M_IsSystem;
                    case "M_Close": return _M_Close;
                    case "M_Icon": return _M_Icon;
                    case "M_Info": return _M_Info;
                    default: return base[name];
                }
            }
            set
            {
                switch (name)
                {
                    case "ModuleID": _ModuleID = Convert.ToInt32(value); break;
                    case "M_ApplicationID": _M_ApplicationID = Convert.ToInt32(value); break;
                    case "M_ParentID": _M_ParentID = Convert.ToInt32(value); break;
                    case "M_PageCode": _M_PageCode = Convert.ToString(value); break;
                    case "M_CName": _M_CName = Convert.ToString(value); break;
                    case "M_Directory": _M_Directory = Convert.ToString(value); break;
                    case "M_OrderLevel": _M_OrderLevel = Convert.ToString(value); break;
                    case "M_IsSystem": _M_IsSystem = Convert.ToInt32(value); break;
                    case "M_Close": _M_Close = Convert.ToInt32(value); break;
                    case "M_Icon": _M_Icon = Convert.ToString(value); break;
                    case "M_Info": _M_Info = Convert.ToString(value); break;
                    default: base[name] = value; break;
                }
            }
        }
        #endregion

        #region 字段名
        /// <summary>取得功能模块字段信息的快捷方式</summary>
        public class _
        {
            ///<summary>功能模块ID号</summary>
            public static readonly FieldItem ModuleID = Meta.Table.FindByName("ModuleID");

            ///<summary>所属应用程序ID</summary>
            public static readonly FieldItem M_ApplicationID = Meta.Table.FindByName("M_ApplicationID");

            ///<summary>所属父级模块ID与ModuleID关联,0为顶级</summary>
            public static readonly FieldItem M_ParentID = Meta.Table.FindByName("M_ParentID");

            ///<summary>模块编码Parent为0,则为S00(xx),否则为S00M00(xx)</summary>
            public static readonly FieldItem M_PageCode = Meta.Table.FindByName("M_PageCode");

            ///<summary>模块/栏目名称当ParentID为0为模块名称</summary>
            public static readonly FieldItem M_CName = Meta.Table.FindByName("M_CName");

            ///<summary>模块/栏目???录名</summary>
            public static readonly FieldItem M_Directory = Meta.Table.FindByName("M_Directory");

            ///<summary>当前所在排序级别支持双层99级菜单</summary>
            public static readonly FieldItem M_OrderLevel = Meta.Table.FindByName("M_OrderLevel");

            ///<summary>是否为系统模块1:是0:否如为系统则无法修改</summary>
            public static readonly FieldItem M_IsSystem = Meta.Table.FindByName("M_IsSystem");

            ///<summary>是否关闭1:是0:否</summary>
            public static readonly FieldItem M_Close = Meta.Table.FindByName("M_Close");

            ///<summary>模块Icon</summary>
            public static readonly FieldItem M_Icon = Meta.Table.FindByName("M_Icon");

            ///<summary>模块说明</summary>
            public static readonly FieldItem M_Info = Meta.Table.FindByName("M_Info");
        }
        #endregion
    }

    /// <summary>功能模块接口</summary>
    public partial interface Isys_Module
    {
        #region 属性
        /// <summary>功能模块ID号</summary>
        Int32 ModuleID { get; set; }

        /// <summary>所属应用程序ID</summary>
        Int32 M_ApplicationID { get; set; }

        /// <summary>所属父级模块ID与ModuleID关联,0为顶级</summary>
        Int32 M_ParentID { get; set; }

        /// <summary>模块编码Parent为0,则为S00(xx),否则为S00M00(xx)</summary>
        String M_PageCode { get; set; }

        /// <summary>模块/栏目名称当ParentID为0为模块名称</summary>
        String M_CName { get; set; }

        /// <summary>模块/栏目???录名</summary>
        String M_Directory { get; set; }

        /// <summary>当前所在排序级别支持双层99级菜单</summary>
        String M_OrderLevel { get; set; }

        /// <summary>是否为系统模块1:是0:否如为系统则无法修改</summary>
        Int32 M_IsSystem { get; set; }

        /// <summary>是否关闭1:是0:否</summary>
        Int32 M_Close { get; set; }

        /// <summary>模块Icon</summary>
        String M_Icon { get; set; }

        /// <summary>模块说明</summary>
        String M_Info { get; set; }
        #endregion

        #region 获取/设置 字段值
        /// <summary>
        /// 获取/设置 字段值。
        /// </summary>
        /// <param name="name">字段名</param>
        /// <returns></returns>
        Object this[String name] { get; set; }
        #endregion
    }
}